System.register(["@angular/http", "ng2-layer", "@angular/core", "@angular/forms", "app/Service", "app/Directives", "@angular/common"], function (exports_1, context_1) {
    "use strict";
    var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
        var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
        if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
        else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
        return c > 3 && r && Object.defineProperty(target, key, r), r;
    };
    var __metadata = (this && this.__metadata) || function (k, v) {
        if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
    };
    var __moduleName = context_1 && context_1.id;
    var http_1, ng2_layer_1, core_1, forms_1, Service_1, Directives_1, common_1, MenuComp, AddBoxComp, _a, _b, _c;
    return {
        setters: [
            function (http_1_1) {
                http_1 = http_1_1;
            },
            function (ng2_layer_1_1) {
                ng2_layer_1 = ng2_layer_1_1;
            },
            function (core_1_1) {
                core_1 = core_1_1;
            },
            function (forms_1_1) {
                forms_1 = forms_1_1;
            },
            function (Service_1_1) {
                Service_1 = Service_1_1;
            },
            function (Directives_1_1) {
                Directives_1 = Directives_1_1;
            },
            function (common_1_1) {
                common_1 = common_1_1;
            }
        ],
        execute: function () {
            MenuComp = (function () {
                function MenuComp(http, layer, parent, notify) {
                    var _this = this;
                    this.http = http;
                    this.layer = layer;
                    this.parent = parent;
                    this.notify = notify;
                    this.boxs = [];
                    this.http.get({
                        search: {
                            m: "Admin",
                            c: "ApiBox",
                            a: "getBoxBySchool"
                        }
                    }).then(function (data) {
                        _this.boxs = data.data.box_list;
                    });
                    notify.subscribe(function (isLogin) {
                        if (!_this.boxs) {
                            http.get({
                                search: {
                                    m: "Admin",
                                    c: "ApiBox",
                                    a: "getBoxBySchool"
                                }
                            }).then(function (data) {
                                _this.boxs = data.data.box_list;
                            });
                        }
                    });
                }
                MenuComp.prototype.addBox = function () {
                    this.layer.dialog({
                        dialogComponent: AddBoxComp,
                        parent: this.parent,
                        title: "添加盒子",
                        imports: [forms_1.FormsModule, Directives_1.DirectivesM, common_1.CommonModule],
                        data: { boxs: this.boxs }
                    });
                };
                return MenuComp;
            }());
            MenuComp = __decorate([
                core_1.Component({
                    selector: 'aside',
                    templateUrl: 'template/app/menu.html'
                }),
                __metadata("design:paramtypes", [http_1.Http, typeof (_a = typeof ng2_layer_1.NgLayer !== "undefined" && ng2_layer_1.NgLayer) === "function" && _a || Object, core_1.ViewContainerRef, typeof (_b = typeof Service_1.Notify !== "undefined" && Service_1.Notify) === "function" && _b || Object])
            ], MenuComp);
            exports_1("MenuComp", MenuComp);
            AddBoxComp = (function () {
                function AddBoxComp(http, dialog) {
                    this.http = http;
                    this.dialog = dialog;
                    this.box = {
                        color: "FF5959",
                        bg_img: ""
                    };
                    this.colors = ["FF5959", "F2CA00", "00E699", "5533FF", "FF7919", "44e645", "4DB1FE", "000000"];
                    this.icons = ["&#xe600;", "&#xe601;", "&#xe602;", "&#xe603;", "&#xe604;", "&#xe605;", "&#xe606;", "&#xe607;", "&#xe608;",
                        "&#xe609;", "&#xe60a;", "&#xe60b;", "&#xe60c;", "&#xe60d;", "&#xe60e;", "&#xe60f;", "&#xe610;", "&#xe611;",
                        "&#xe612;", "&#xe613;"];
                }
                AddBoxComp.prototype.addBox = function () {
                    var _this = this;
                    this.http.post({
                        message: "保存盒子数据...",
                        search: {
                            m: "Admin",
                            c: "ApiBox",
                            a: "addBox"
                        },
                        body: {
                            color: this.box.color,
                            bg_img: this.box.bg_img,
                            name: this.box.name,
                            type: this.box.type
                        }
                    }).then(function (data) {
                        _this.dialog.close();
                        _this.boxs.push(data.data);
                    });
                };
                return AddBoxComp;
            }());
            AddBoxComp = __decorate([
                core_1.Component({ templateUrl: "template/dialog/addBox.html" }),
                __metadata("design:paramtypes", [http_1.Http, typeof (_c = typeof ng2_layer_1.NgLayerRef !== "undefined" && ng2_layer_1.NgLayerRef) === "function" && _c || Object])
            ], AddBoxComp);
        }
    };
});
